let token = getToken();
let user = JSON.parse(window.localStorage.getItem("userInfo"));
if (user) {
  $("#nickname").val(user.name);
  $("#zname").val(user.zName);
  $("#mobile").val(user.mobile);
  $("#name").val(user.name);
  $("#userName").val(user.userName);
} else {
  mui.alert("您还未登录，请先登录");
}

$("#subPay").click(function () {
  let users = {
    nickname: $("#nickname").val(),
    zname: $("#zname").val(),
    mobile: $("#mobile").val(),
    id: user.id,
    name: $("#name").val(),
    userName: $("#userName").val(),
    password: $("#password").val(),
  };
  if (checkJson(users) == false) {
    mui.alert("请填写完整");
    return false;
  }
  var res = playPut("/v1/api/users/cz/no", "", users, token);
  if (res.code == 200) {
    mui.alert("修改成功");
    window.localStorage.setItem("userInfo", JSON.stringify(res.users));
    setTimeout(() => {
      location.href = "index.html";
    }, 1000);
  } else {
    mui.alert(res.msg);
  }
});
